<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>父子组件传递的问题</title>
</head>
<body>
<div id="app">
    <h1>父：{{value}}</h1>
    <btn :house="name" @abs="pdd"></btn>
</div>
<template id="btn">
   <div>
       <h2>子：{{house}}</h2>
       <button @click="com">给父组件一辆车</button>
   </div>
</template>
<script src="../vue.js"></script>
<script>
    var btn = {
        props:['house'],
        template:'#btn',
        methods:{
            com(){
                this.$emit('abs','宝马750')
            }
        }
    }
    new Vue({
        el:'#app',
        data(){
            return{
                name:'房子',
                value:''
            }
        },
        components:{
            btn,
        },
        methods: {
            pdd(val){
                this.value = val;
            }
        }
    })
</script>
</body>
</html>